<%@ page language="java" contentType="text/html; charset=UTF8"
    pageEncoding="UTF8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>     
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>Questionnaire</title>
<script type="text/javascript" src="component/jquery-3.1.1.js"></script>
	<script type="text/javascript" src="component/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="common/js/questionnaire/questionnaire.js"></script>

</head>
<body>
<h1>${questionnaireCurrent.questionnaireName}</h1>
<button type="button" class="btn7" value="Add" onclick="window.location.href='toAddQuestion.action'" >增加问题</button>
&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" id="deleteOptionMulti">删除已选选项</button>
<button type="button" id="editOptionSingle"> 修改单个选项</button>
<br><br>
  <c:if test="${!empty questionList }">  
                <c:forEach items="${questionList}" var="question">
                <div class="question">${question.questionNumber}：${question.questionName}
                <input type="hidden" value="${question.questionId}">
                <input class="questionType" type="hidden" value="${question.questionType}">
                <button class="addOptionButton" type="button" onclick="window.location.href='toAddOption.action?questionId=${question.questionId}'" >增加选项</button>
                <button type="button" onclick="window.location.href='toEditQuestion.action?questionId=${question.questionId}'" >编辑</button>
                <button class="deleteButton" type="button" onclick="window.location.href='deleteQuestion.action?questionId=${question.questionId}'" >删除</button>
                <div class="option"></div>
                </div>
                </c:forEach>
  </c:if>
  
	<br><div id="submittedUserList">
		Submitted User List：
		<c:if test="${!empty submittedUserIdList}">
			<c:forEach items="${submittedUserIdList}" var="answer">
			<%-- <fmt:formatDate value="${answer.answerTime}" pattern="yyyy-MM-dd"/> --%>
			
				<div class="submittedUser"><input type="hidden" value="${answer.answerUser}"><p class="userName"></p>：<fmt:formatDate value="${answer.answerTime}" pattern="yyyy-MM-dd HH:mm"/>
				<a href="getQuestionByQuestionnaireBack.action?questionnaireId=${sessionScope.questionnaireId}&chosedUser=${answer.answerUser}">
				查看答卷</a>
				</div>
				<%-- <div class="submittedUser">${answer.answerUser}：<fmt:formatDate value="${answer.answerTime}" type="both"/>
				<a href="getQuestionByQuestionnaireBack.action?questionnaireId=${sessionScope.questionnaireId}">
				查看答卷</a>
				</div> --%>
			</c:forEach>
		</c:if>
	</div>
	<br>
	<button id="backToList" onclick= "window.location='allQuestionnaire.action?number=1'">Back</button>
</body>
</html>